use Mail::Sender;
my ($sender,$msg,$email,$SUBJECT);

$email='milds@bkkkk.ru';
$SUBJECT='TEST MESSAGE';
$msg="
1111111111111111\n
22222222222222222\n
33333333333333333\n
";
$file=4;

sendmessage();

die();


sub sendmessage{



$sender = new Mail::Sender {from => 'robot_yes@bk.ru',
                               smtp => 'smtp.bk.ru',
                               skip_bad_recipients => '1',
                               auth=>'LOGIN',
                               authid=>'robot_yes@bk.ru',
                               authpwd=>'dimaleraimisha'};



$sender->OpenMultipart({
                        to => "$email",
                        replyto => 'robot_yes@bk.ru',
                        boundary => 'boundary-letter-1',
                        multipart => 'related',
                        subject => "$SUBJECT"
                        });

$sender->Part(ctype=>'multipart/alternative');

$sender->Part({ ctype => 'text/plain; charset=windows-1251',
                            disposition => 'NONE',
                                msg => "$msg" });
                                
                                
$sender->EndPart('multipart/alternative');

$sender->Attach({ description => "zip", file => "BASIC/${file}.zip" });

if ($sender->Close()) {
    print "Ok"; 
} else {
    print $sender->{'error_msg'}
}

}